package com.ps.dao.person;

import java.sql.Timestamp;
import java.util.List;
import org.hibernate.LockMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.dao.support.DaoSupport;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;


import com.ps.dao.BaseDaoSupport;
import com.ps.pojo.person.Employee;

/**
 * A data access object (DAO) providing persistence and search support for
 * Employee entities. Transaction control of the save(), update() and delete()
 * operations can directly support Spring container-managed transactions or they
 * can be augmented to handle user-managed Spring transactions. Each of these
 * methods provides additional information for how to configure it for the
 * desired type of transaction control.
 * 
 * @see com.ps.pojo.person.Employee
 * @author MyEclipse Persistence Tools
 */

public class EmployeeDAO extends BaseDaoSupport<Employee> {

	// property constants
	public static final String EMPLOYEE_NUM = "employeeNum";
	public static final String USER_NAME = "userName";
	public static final String ROLE_ID = "roleId";
	public static final String NAME = "name";
	public static final String JURISDICTIONS = "jurisdictions";
	public static final String WORK_POSITION_ID = "workPositionId";
	public static final String JOB_TITLE_ID = "jobTitleId";
	public static final String HOME_PHONE = "homePhone";
	public static final String MOBILE_PHONE = "mobilePhone";
	public static final String OFFIC_PHONE = "officPhone";
	public static final String TALK_CODE = "talkCode";
	public static final String EMAIL = "email";
	public static final String POST_CODE = "postCode";
	public static final String NATIVE_PLACE = "nativePlace";
	public static final String FOLK = "folk";
	public static final String SEX = "sex";
	public static final String IDENTITY_CARD = "identityCard";
	public static final String NOW_LIVE_ADDRESS = "nowLiveAddress";
	public static final String PERMANENT_ADDRESS = "permanentAddress";
	public static final String ARCHIVES_ADDRESS = "archivesAddress";
	public static final String MARRY_STATUS = "marryStatus";
	public static final String POLITICAL = "political";
	public static final String EDUCATION = "education";
	public static final String MAJOR = "major";
	public static final String SKILL = "skill";
	public static final String GRADUATE_SCHOOL = "graduateSchool";
	public static final String IN_WORKING = "inWorking";
	public static final String SALARY_WITHHELD_STAUTS = "salaryWithheldStauts";
	public static final String BANK_NAME = "bankName";
	public static final String BANK_ACCOUNT_NUM = "bankAccountNum";
	public static final String ICON = "icon";
	public static final String PASSWORD = "password";
	public static final String REMARK = "remark";
	public static final String INPUTER_ID = "inputerId";

	protected void initDao() {

	}

	public List<Employee> findByEmployeeNum(Object employeeNum) {
		return findByProperty(EMPLOYEE_NUM, employeeNum);
	}

	public List<Employee> findByUserName(Object userName) {
		return findByProperty(USER_NAME, userName);
	}

	public List<Employee> findByRoleId(Object roleId) {
		return findByProperty(ROLE_ID, roleId);
	}

	public List<Employee> findByName(Object name) {
		return findByProperty(NAME, name);
	}

	public List<Employee> findByJurisdictions(Object jurisdictions) {
		return findByProperty(JURISDICTIONS, jurisdictions);
	}

	public List<Employee> findByWorkPositionId(Object workPositionId) {
		return findByProperty(WORK_POSITION_ID, workPositionId);
	}

	public List<Employee> findByJobTitleId(Object jobTitleId) {
		return findByProperty(JOB_TITLE_ID, jobTitleId);
	}

	public List<Employee> findByHomePhone(Object homePhone) {
		return findByProperty(HOME_PHONE, homePhone);
	}

	public List<Employee> findByMobilePhone(Object mobilePhone) {
		return findByProperty(MOBILE_PHONE, mobilePhone);
	}

	public List<Employee> findByOfficPhone(Object officPhone) {
		return findByProperty(OFFIC_PHONE, officPhone);
	}

	public List<Employee> findByTalkCode(Object talkCode) {
		return findByProperty(TALK_CODE, talkCode);
	}

	public List<Employee> findByEmail(Object email) {
		return findByProperty(EMAIL, email);
	}

	public List<Employee> findByPostCode(Object postCode) {
		return findByProperty(POST_CODE, postCode);
	}

	public List<Employee> findByNativePlace(Object nativePlace) {
		return findByProperty(NATIVE_PLACE, nativePlace);
	}

	public List<Employee> findByFolk(Object folk) {
		return findByProperty(FOLK, folk);
	}

	public List<Employee> findBySex(Object sex) {
		return findByProperty(SEX, sex);
	}

	public List<Employee> findByIdentityCard(Object identityCard) {
		return findByProperty(IDENTITY_CARD, identityCard);
	}

	public List <Employee>findByNowLiveAddress(Object nowLiveAddress) {
		return findByProperty(NOW_LIVE_ADDRESS, nowLiveAddress);
	}

	public List<Employee> findByPermanentAddress(Object permanentAddress) {
		return findByProperty(PERMANENT_ADDRESS, permanentAddress);
	}

	public List<Employee> findByArchivesAddress(Object archivesAddress) {
		return findByProperty(ARCHIVES_ADDRESS, archivesAddress);
	}

	public List<Employee> findByMarryStatus(Object marryStatus) {
		return findByProperty(MARRY_STATUS, marryStatus);
	}

	public List<Employee> findByPolitical(Object political) {
		return findByProperty(POLITICAL, political);
	}

	public List<Employee> findByEducation(Object education) {
		return findByProperty(EDUCATION, education);
	}

	public List<Employee> findByMajor(Object major) {
		return findByProperty(MAJOR, major);
	}

	public List<Employee> findBySkill(Object skill) {
		return findByProperty(SKILL, skill);
	}

	public List<Employee> findByGraduateSchool(Object graduateSchool) {
		return findByProperty(GRADUATE_SCHOOL, graduateSchool);
	}

	public List<Employee> findByInWorking(Object inWorking) {
		return findByProperty(IN_WORKING, inWorking);
	}

	public List<Employee> findBySalaryWithheldStauts(Object salaryWithheldStauts) {
		return findByProperty(SALARY_WITHHELD_STAUTS, salaryWithheldStauts);
	}

	public List<Employee> findByBankName(Object bankName) {
		return findByProperty(BANK_NAME, bankName);
	}

	public List<Employee> findByBankAccountNum(Object bankAccountNum) {
		return findByProperty(BANK_ACCOUNT_NUM, bankAccountNum);
	}

	public List<Employee> findByIcon(Object icon) {
		return findByProperty(ICON, icon);
	}

	public List<Employee> findByPassword(Object password) {
		return findByProperty(PASSWORD, password);
	}

	public List<Employee> findByRemark(Object remark) {
		return findByProperty(REMARK, remark);
	}

	public List<Employee> findByInputerId(Object inputerId) {
		return findByProperty(INPUTER_ID, inputerId);
	}

	public static EmployeeDAO getFromApplicationContext(ApplicationContext ctx) {
		return (EmployeeDAO) ctx.getBean("EmployeeDAO");
	}
}